/*
 * @Author: liuzehai
 * @Date: 2021-04-16 16:39:05
 * @LastEditTime: 2021-05-21 16:16:34
 * @LastEditors: liuzehai
 * @FilePath: /Card-to-payh5/vue.config.js
 * @Description: 由liuzehai创建！
 */
'use strict'
// const path = require('path');
const isEnvApp = !!process.env.VUE_APP_FOR_APP;
const Timestamp = new Date().toLocaleDateString().replace(/\//g, '-');

module.exports = {
  /**
   * You will need to set publicPath if you plan to deploy your site under a sub path,
   * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
   * then publicPath should be set to "/bar/".
   * In most cases please use '/' !!!
   * Detail: https://cli.vuejs.org/config/#publicpath
   */
  publicPath: isEnvApp ? '': '/mobile',
  outputDir: isEnvApp ? '../www': 'dist',
  assetsDir: `static_${Timestamp}`,
  filenameHashing: process.env.NODE_ENV === 'development',
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  pluginOptions: isEnvApp ? {} : {
    cordovaPath: 'src-cordova'
  },
  devServer: {
    open: true,
    https: false,
    proxy: {
      //配置跨域
      [process.env.VUE_APP_BASE_API]: {
        target: process.env.VUE_APP_SERVICE_URL,
        changOrigin: true,
        logLevel:'debug',
        pathRewrite: {
          ["^" + process.env.VUE_APP_BASE_API]: ""
        }
      },
      [process.env.VUE_APP_LIST_API]: {
        target: process.env.VUE_APP_LIST_URL,
        changeOrigin: true,
        logLevel:'debug',
        pathRewrite: {
          ["^" + process.env.VUE_APP_LIST_API]: ""
        }
      },
      [process.env.VUE_APP_UPLOAD_API]: {
        target: process.env.VUE_APP_UPLOAD_URL,
        changeOrigin: true,
        logLevel:'debug',
        pathRewrite: {
          ["^" + process.env.VUE_APP_UPLOAD_API]: ""
        }
      },
      [process.env.VUE_APP_PARTY_API]: {
        target: process.env.VUE_APP_PARTY_URL,
        changeOrigin: true,
        logLevel:'debug',
        pathRewrite: {
          ["^" + process.env.VUE_APP_PARTY_API]: ""
        }
      },
      [process.env.VUE_APP_CARD_API]: {
        target: process.env.VUE_APP_CARD_URL,
        changeOrigin: true,
        logLevel:'debug',
        pathRewrite: {
          ["^" + process.env.VUE_APP_CARD_API]: ""
        }
      },
    },
  },
}